package com.wyvoid.core.servlet;

import com.wyvoid.core.util.ValidateCodeCreator;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import java.io.IOException;

/**
 * <p>51void.com</p>
 * User:cjp
 * Date: 2007-5-19
 * Time: 6:07:50
 */
public class ValidateCodeServlet extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int width = 60;
        int charNum = 4;
        try {
            String num = request.getParameter("charNum");
            if (num != null) {
                charNum = Integer.parseInt(num);
                width = charNum * 15;
            }
        }
        catch (Exception e) {
        }

        String[] chars={"0","1","2","3","4","5","6","7","8","9"};
        ValidateCodeCreator vcc = new ValidateCodeCreator();
        vcc.create(request, response, width, 20, charNum, chars);
    }
}
